home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Atari Compendium
/
The Atari Compendium (Toad Computers) (1994).iso
/
files
/
umich
/
utils
/
catch.zoo
/
catch.doc
next >
Wrap
Text File
|
1990-03-25
|
4KB
|
76 lines
CATCH - A Master Module for Signal handling
The program catch.mmx is intended as a Master-Module-eXtension to install a
signal-handler for all programs. It hooks itself into the keyboard-interrupt
vector of the atari st. If you press ^Z not preceeded by ^V then the current
program is stopped. The shell is called with system("-i"). If you press ^C,
the program is terminated with return value -32, but you are asked for
confirmation. A timeout can also be installed.
The program can work in one of three ways:
1) it installs the handler and returns to the shell with system("-i")
when you exit the recursive shell, the handler is deinstalled
2) it installs itself as a resident program with a cookie at 0x5A0
(this can be done from the AUTO folder at system startup time if you
rename it to catch.prg) and can be called from any application
3) the program can be started again to configure an already installed
version of itself
If at any time the program is started with Master's module command, a new
command is added to Master's builtin commands. This new command is CATCH and
calls the routine recorded in the module_header pointed to by the cookie CTCH.
What can you do with the "catch"-command ?
The following subcommands are available:
help lists a short summary
<num> installs a timeout in <num> seconds; the program running at
that moment will be terminated immediately if its basepage is
in higher memory than the reference-basepage (that's the
address of the father of the first catch.mmx by default) and
the routine at _shell_p (0x4F6).
<sc> use <sc> as the new stop character (default is ^Z); the
character can be entered with eg. ^V^Z in Master; if you give
'^' followed by 'Z' then '^' is the stop-char and 'Z' is used
to mask it (see next subcommand)
<sc><mc> like above plus set <mc> as new mask-char (default ^V)
- switch off stop-char and set timeout to zero (disable it)
+ switch on stop-char and timeout
+. install actual basepage as reference-basepage
+.. install father of current basepage as reference
If catch has no parameter, then only the timeout is disabled (but not reset to
zero) and any pending signals are flushed.
How can you use the "catch"-commands ?
First you can call the catch.mmx program and give it the command as parameter
to the -c option. For example "catch.mmx -c help" will print a help-message.
A better way is to install it as Master-Module. Then you can give the commands
as parameter to the "catch"-command like "catch help" without starting a new
version of the program.
Options for the catch.mmx program
There are some options which can be given if the program is started. If you
give it an invalid option, the possible choices are displayed. As mentioned
above you can start the program either as "catch.mmx" or as "module catch".
You can also give a first command to be executed (default "help" if installed
resident, "" else) as parameter to the program. So to install a timeout in
20 seconds, you could use "catch.mmx 20".
---
I hope this program will be useful for anybody working with a shell that allows
system calls to get an interactive shell.
- Edgar
---
This program has been written with the GNU-C Compiler V1.35 on the Atari ST
and is hereby put in the public domain under the conditions of the GNU general
public license. Source code can be obtained from:
Edgar Roeder | roeder@cs.uni-sb.de
Liesbet-Dill-Strasse 3 | roeder@eansb.informatik.uni-saarland.dbp.de
D-6602 Dudweiler |
W-Germany |